export const showLoading = () => {
  showLoadingToast({
    duration: 10000,
    message: `loading...`,
    forbidClick: true,
  });
};

export const closeLoading = () => {
  closeToast();
};

export const showError = (error: Error | { message: string } | unknown) => {
  const errorMessage =
    typeof error === "object" && error !== null && "message" in error
      ? String(error.message)
      : String(error);

  showNotify({
    type: "danger",
    message: errorMessage,
    duration: 2000,
    position: "top",
  });
};

export const showMsg = (message: string) =>
  showToast({
    message,
    position: "top",
    duration: 2000,
  });
